package com.woniuxy.food.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.cloud.mall95.log.Log;
import com.woniuxy.food.client.foodpropvalueclient.FoodPropValueManageClient;
import com.woniuxy.food.client.param.InsertFoodPropValueParam;
import com.woniuxy.food.service.FoodPropValueService;
import com.woniuxy.food.service.serviceparam.InsertFoodPropServiceParam;
import com.woniuxy.food.service.serviceparam.InsertFoodPropValueServiceParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import result.Result;

@RestController
public class FoodPropValueManageClientApiImpl implements FoodPropValueManageClient {

    @Autowired
    private FoodPropValueService foodPropValueService;
    @Override
    @Log("添加菜品属性值")
    public Result insertFoodPropValue(InsertFoodPropValueParam param) {
        InsertFoodPropValueServiceParam insertFoodPropValueServiceParam = BeanUtil.toBean(param, InsertFoodPropValueServiceParam.class);
        foodPropValueService.insertFoodPropValue(insertFoodPropValueServiceParam);
        return Result.success();
    }

    @Override
    @Log("根据ID删除菜品属性值")
    public Result deleteFoodPropValue(Integer storeId,Integer foodPropValueId) {
        foodPropValueService.deleteFoodPropValue(storeId,foodPropValueId);
        return Result.success();
    }
}
